import request from '@/utils/request'
export const getEmpList = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}

export const exportEmployee = () => {
  return request({
    url: '/sys/user/export',
    responseType: 'blob'
  })
}

export const downloadImportTemaplate = () => {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

export const uploadFile = (data) => {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data
  })
}

export const delEmp = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

export const addEmp = (data) => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

export const getEmpInfo = (id) => {
  return request({
    url: `/sys/user/${id}`
  })
}

export const updateEmpInfo = (id, data) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'put',
    data
  })
}
export const getEnabledRole = () => {
  return request({
    url: '/sys/role/list/enabled'
  })
}

export const assignRole = (id, roleIds) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data: {
      id,
      roleIds
    }
  })
}
